#!/bin/sh

# check if svn info available (do not write anything)
svn info 2> /dev/null > /dev/null

if [ $? = 0 ] ; then 
# svn info available: get svn revision
   #svn_rev=$(svnversion -n)
   svn_rev=$(svn info |grep "Revision:" | cut -d' ' -f2)
else
# svn info available: revert to no info
   svn_rev=unknown
fi

cat >tddft_version.f90 <<EOF
!
! Copyright (C) 2003-2014 Quantum ESPRESSO group
! This file is distributed under the terms of the
! GNU General Public License. See the file \`License'
! in the root directory of the present distribution,
! or http://www.gnu.org/copyleft/gpl.txt .
!

! NOTE: this file is automatically created

!----------------------------------------------------------------------------
MODULE tddft_version
  !
  IMPLICIT NONE
  !
  SAVE
  !
  CHARACTER (LEN=12) :: tddft_svn_revision = "$svn_rev"
  !
END MODULE tddft_version
EOF

